//
//  NSUsageNumView.m
//  Meboo
//
//  Created by kyo on 2024/5/9.
//

#import "NSUsageNumView.h"
@interface NSUsageNumView ()
@property(nonatomic,strong) UIImageView *wlmImageView;
@end

@implementation NSUsageNumView

#pragma mark - Life Cycle
- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self setupUI];
    }
    return self;
}

#pragma mark - UI
- (void)setupUI {
    self.backgroundColor = UIColor.clearColor;
    
    [self addSubview:self.wlmImageView];
    [self.wlmImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.bottom.equalTo(self);
        make.top.mas_equalTo(MBHeightScale(4));
        make.right.mas_equalTo(MBHeightScale(-4));
    }];
    
    [self addSubview:self.numLab];
    [self.numLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.top.equalTo(self);
        make.width.height.mas_equalTo(MBHeightScale(24));
    }];
}

#pragma mark - Setter && Getter

- (UIImageView *)wlmImageView {
    if (!_wlmImageView) {
        _wlmImageView = [UIImageView new];
        _wlmImageView.contentMode = UIViewContentModeScaleAspectFill;
        _wlmImageView.clipsToBounds = YES;
        _wlmImageView.image = ImageWithName(@"wlm_matched_useNum");
    }
    return _wlmImageView;
}
- (UILabel *)numLab {
    if (!_numLab) {
        _numLab = [UILabel new];
        _numLab.text = @"0";
        _numLab.textAlignment = NSTextAlignmentCenter;
        _numLab.backgroundColor = HEXS(@"FF485F");
        _numLab.layer.cornerRadius = MBHeightScale(12);
        _numLab.layer.masksToBounds = YES;
        _numLab.font = MBHelFontSizeScale(14);
        _numLab.textColor = HEXS(@"ffffff");
    }
    return _numLab;
}
@end
